package cn.etynit.mms.fallback;

import cn.etynit.domain.ExpensesProperty;
import cn.etynit.exception.GlobalExceptionCodeEnum;
import cn.etynit.mms.feign.ExpensesPropertyService;
import cn.etynit.result.JsonResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class ExpensesPropertyServiceFallbackFactory implements FallbackFactory<ExpensesPropertyService> {
    @Override
    public ExpensesPropertyService create(Throwable throwable) {
        return new ExpensesPropertyService() {
            @Override
            public JsonResult saveOrUpdate(ExpensesProperty expensesProperty) {
                return JsonResult.error(GlobalExceptionCodeEnum.ERROR);
            }
        };
    }
}
